package cn.iocoder.devlop.module.annual.report.sfclicenceinfo.controller.app;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;

import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.*;
import java.util.*;

import cn.iocoder.devlop.framework.common.pojo.CommonResult;
import static cn.iocoder.devlop.framework.common.pojo.CommonResult.success;

import cn.iocoder.devlop.module.annual.report.sfclicenceinfo.controller.vo.*;
import cn.iocoder.devlop.module.annual.report.sfclicenceinfo.dal.dataobject.SfcLicenceinfoDO;
import cn.iocoder.devlop.module.annual.report.sfclicenceinfo.convert.SfcLicenceinfoConvert;
import cn.iocoder.devlop.module.annual.report.sfclicenceinfo.service.SfcLicenceinfoService;

@Tag(name = "用户 APP - 年报农合行政许可信息")
@RestController
@RequestMapping("/annual/report/sfc-licenceinfo")
@Validated
public class AppSfcLicenceinfoController {

    @Resource
    private SfcLicenceinfoService sfcLicenceinfoService;

    @GetMapping("/list")
    @Operation(summary = "获得年报股权变更信息列表")
    public CommonResult<List<SfcLicenceinfoRespVO>> getSfcLicenceinfoList(@RequestParam("regno") String regno, @RequestParam("ancheyear") String ancheyear) {
        List<SfcLicenceinfoDO> list = sfcLicenceinfoService.getSfcLicenceinfoList(regno, ancheyear);
        return success(SfcLicenceinfoConvert.INSTANCE.convertList(list));
    }

    @PutMapping("/overwrite")
    @Operation(summary = "覆盖更新年报股权变更信息列表")
    public CommonResult<Boolean> overwriteSfcLicenceinfo(@Valid @RequestBody SfcLicenceinfoOverwriteVO updateReqVO) {
        sfcLicenceinfoService.overwriteSfcLicenceinfo(updateReqVO);
        return success(true);
    }

}
